<?php /* Smarty version 2.6.20, created on 2016-07-19 15:10:19
         compiled from product.htm */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'in_array', 'product.htm', 78, false),array('modifier', 'date_format', 'product.htm', 315, false),)), $this); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>产品管理</h3>
        </div>
    </div>
    
    <div class="h35"></div>
    <script type="text/javascript">
    $(function(){
        /* 全选 */
         $('.checkall').click(function(){
            var _self = this;
            $('.checkitem').each(function(){
                if (!this.disabled)
                {
                    $(this).attr('checked', _self.checked);
                }
            });
            $('.checkall').attr('checked', this.checked);
        });	 
    });
    </script>
    <form action="" method="get">
    <input type="hidden" name="m" value="product">
    <input type="hidden" name="s" value="product.php">
    <table class="select_table">
        <tbody>
            <tr>
                <td width="60">产品名称:</td>
                <td width="200"><input id="name" type="text" name="name" class="w200" value="<?php echo $_GET['name']; ?>
" /></td>
                
                <td width="60">产品ID:</td>
                <td width="200"><textarea id="code" name="code" class="w200" style="resize:horizontal;height:20px;"><?php echo $_GET['code']; ?>
</textarea></td>
                
                <td width="70">产品分类:</td>
                <td width="100">
                 <select class="ws350" name='cat'  id="cat">
                    	<option value='0'>全部分类</option>
                        <?php $_from = $this->_tpl_vars['de']['cat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             			<option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['list']['catid'] || $_GET['cat'] == $this->_tpl_vars['list']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['catid']; ?>
"><?php echo $this->_tpl_vars['list']['cat']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['slist']['catid'] || $_GET['cat'] == $this->_tpl_vars['slist']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['catid']; ?>
">|__<?php echo $this->_tpl_vars['slist']['cat']; ?>
</option>
                            	    
                                    <?php $_from = $this->_tpl_vars['slist']['scat']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
                                    <option <?php if ($this->_tpl_vars['re']['cid'] == $this->_tpl_vars['lists']['catid'] || $_GET['cat'] == $this->_tpl_vars['lists']['catid']): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['catid']; ?>
">|____<?php echo $this->_tpl_vars['lists']['cat']; ?>
</option>
                            		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
                </td>
                <td width="60">品牌：</td>
                <td>
               		<input type="hidden" name="brandid" id="brandid" value="<?php echo $_GET['brandid']; ?>
"/>
                    <input style="width:150px;" type='text' name='brand' id='brand' value="<?php echo $_GET['brand']; ?>
" placeholder='输入搜索词' autocomplete="off"/>
            		<ul id="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;">
        			</ul>
                </td>
                <td width="60">标签：</td>
                <td>
                	<select name="tags">
            			<option value="">选择标签</option>
                		<?php $_from = $this->_tpl_vars['de']['all_tags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                        
             				<option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['list']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['list']['id']; ?>
"><?php echo $this->_tpl_vars['list']['tags']; ?>
</option>
                           
                            <?php $_from = $this->_tpl_vars['list']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['slist']):
?>
                            	<option  <?php if (@ ((is_array($_tmp=$this->_tpl_vars['slist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['slist']['id']; ?>
">|__<?php echo $this->_tpl_vars['slist']['tags']; ?>
</option>
                            	    
                                <?php $_from = $this->_tpl_vars['slist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['sslist']):
?>
                                <option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['sslist']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['sslist']['id']; ?>
">|____<?php echo $this->_tpl_vars['sslist']['tags']; ?>
</option>
                                    
	                                <?php $_from = $this->_tpl_vars['sslist']['stags']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['lists']):
?>
	                                	<option <?php if (@ ((is_array($_tmp=$this->_tpl_vars['lists']['id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['de']['tags']) : in_array($_tmp, $this->_tpl_vars['de']['tags']))): ?> selected="selected" <?php endif; ?> value="<?php echo $this->_tpl_vars['lists']['id']; ?>
">|______<?php echo $this->_tpl_vars['lists']['tags']; ?>
</option>
	                           		<?php endforeach; endif; unset($_from); ?>
                           		<?php endforeach; endif; unset($_from); ?> 
                                    
                            <?php endforeach; endif; unset($_from); ?> 
                            
                        <?php endforeach; endif; unset($_from); ?> 
            		</select>
       			</td>
       		</tr>
       		<tr>	
                <td width="60">状态：</td> 
                
                <td width="80"><select name="statu" id="statu"><option value="">全部产品</option>
                <option value="0" <?php if ('0' === $_GET['statu']): ?>selected="selected"<?php endif; ?>>未送审</option>
                <option value="-2" <?php if ("-2" == $_GET['statu']): ?>selected="selected"<?php endif; ?>>已送审</option>
                <option value="1" <?php if (1 == $_GET['statu']): ?>selected="selected"<?php endif; ?>>已上架</option>
                <option value="2" <?php if (2 == $_GET['statu']): ?>selected="selected"<?php endif; ?>>推荐</option>
                <option value="-1" <?php if (-1 == $_GET['statu']): ?>selected="selected"<?php endif; ?>>被驳回</option>
                <option value="-3" <?php if (-3 == $_GET['statu']): ?>selected="selected"<?php endif; ?>>已下架</option>
                
                </select></td>
                <td width="60">所在仓库：</td> 
                
                <td width="80">
                <select name="stock_shop" id="stock_shop">
                <option value="">全部</option>
                <?php $_from = $this->_tpl_vars['de']['stock_shops']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <option value="<?php echo $this->_tpl_vars['list']['id']; ?>
" <?php if ($_GET['stock_shop'] == $this->_tpl_vars['list']['id']): ?>selected<?php endif; ?> ><?php echo $this->_tpl_vars['list']['show_title']; ?>
</option>
                
                <?php endforeach; endif; unset($_from); ?>
                </select></td>
								<td width="60">责任编辑：</td> 
                
                <td width="80">
                <select name="admin_user" id="admin_user">
                <option value="">全部</option>
                <?php $_from = $this->_tpl_vars['de']['admins']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
                <option value="<?php echo $this->_tpl_vars['list']['user']; ?>
" <?php if ($this->_tpl_vars['admin_user'] == $this->_tpl_vars['list']['user']): ?>selected<?php endif; ?> ><?php echo $this->_tpl_vars['list']['name']; ?>
</option>
                
                <?php endforeach; endif; unset($_from); ?>
                </select></td>
                
                <td width="60">是否在微店：</td> 
                
                <td width="80">
	                <select name="in_micro_shop" id="in_micro_shop">
		                <option value="">全部</option>
		                <option value="0" <?php if ('0' === $_GET['in_micro_shop']): ?>selected="selected"<?php endif; ?>>不在</option>
		                <option value="1" <?php if (1 == $_GET['in_micro_shop']): ?>selected="selected"<?php endif; ?>>在</option>
	                </select>
                </td>
                
                <td><input type="image" src="<?php echo $this->_tpl_vars['config']['weburl']; ?>
/image/admin/search.gif" /></td>
            </tr>
            
        </tbody>
    </table>
    </form>
<!--     <table class="table">
        <tbody>
        <tr>
            <th colspan="99" class="partition">提示</th>
        </tr>
        <tr>
            <td>
                <ul class="tips">
                    <li>通过产品管理，您可以进行编辑产品价格、库存、规格等信息，以及删除产品等操作。</li>
                    <li>请先根据条件搜索产品，然后选择相应的操作。</li>
                </ul>
            </td>
        </tr>
        </tbody>
    </table> -->
       <form method="post" target="export_iframe" id="export_form" action=""><input type="hidden" value="export" name="act"/></form>
    <iframe src="" style="display:none;" id="export_iframe" name="export_iframe"></iframe>
    <form action="?m=product&s=product.php<?php echo $this->_tpl_vars['url']; ?>
" method="post" id="form" name="form">
    <input type="hidden" name="act" value="op" />
    <input type="hidden" name="type" value="" />
    <table class="table product">
        <thead>
        <tr>
            <th colspan="99" class="partition">
            <ul class="button">
                <li class="button">
                    <a class="a_button" href="?m=product&s=product_launch.php">添加产品</a>
                </li>
               <!--  <li class="button">
                	<a id="unify_price"  class="a_button" href="javascript:void(0);">统一调价</a>
                </li> -->
								<li class="button">
								<a id="unify_limit"  class="a_button" href="javascript:void(0);">统一调限购数量</a>
								</li>


                <li class="button">
                    <a class="a_button w60" href="javascript:void(0);"><span>批量操作</span><em></em></a>
                    <div class="select_btn">
                        <ul>
                        	                 <li class="li">
                    <a class="op_button" type="1" href="javascript:void(0);">上架</a>
                </li>
                <li class="li">
                    <a class="op_button" type="2" href="javascript:void(0);">推荐</a>
                </li>
                <li class="li">
                    <a class="op_button" type="-1" href="javascript:void(0);">驳回</a>
                </li>
                <li class="li">
                    <a class="op_button" type="-3" href="javascript:void(0);">下架</a>
                </li>
                            <li class="li"><a class="op_button" type="-9" href="javascript:void(0);">删除</a></li>
                            <?php if (0): ?><li class="li"><a id="unify_stock" href="javascript:void(0);">统一调库存</a></li><?php endif; ?>
                        </ul>
                    </div>
                </li>
                <!-- <li class="button">
                
                        <a class="a_button" href="javascript:;" id="change_cat">移动分类</a>
                
                </li> -->
            </ul>
            
            <div style="float:right" id="els_export">
            <ul class="button">
            	<li class="button">
							<a href="?m=product&s=product.php&act=export_product<?php $_from = $_GET; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['val']):
?>&param[<?php echo $this->_tpl_vars['k']; ?>
]=<?php echo $this->_tpl_vars['val']; ?>
<?php endforeach; endif; unset($_from); ?>"   class="a_button" id="export_product" >主商品导出详情</a>
							</li>
							<li class="button" style="display:none;">
							<a href="?m=product&s=product.php&act=export_product_sku<?php $_from = $_GET; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['val']):
?>&param[<?php echo $this->_tpl_vars['k']; ?>
]=<?php echo $this->_tpl_vars['val']; ?>
<?php endforeach; endif; unset($_from); ?>"   class="a_button" id="export_product_sku" >SKU导出详情</a>
							</li>
							<li class="button">
            <a  class="a_button" href="?m=product&s=product.php&act=export_product_id<?php $_from = $_GET; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['k'] => $this->_tpl_vars['val']):
?>&param[<?php echo $this->_tpl_vars['k']; ?>
]=<?php echo $this->_tpl_vars['val']; ?>
<?php endforeach; endif; unset($_from); ?>">只导出产品ID</a>
            </li>
						</ul>
						</div>
            </th>
        </tr>
        </thead>
        <tbody>
            <tr class="header">
                <!-- <th width="1"></th> -->
                <th width="15"><input type="checkbox" class="checkall" id="del"></th>
                <th width="40">产品ID</th>
                <th colspan="2">产品名称</th>
                <th width="60">所属标签</th>
                <th width="60">所属活动</th>
                <th width="80">规格</th>
                <th width="55">销售价</th>
                <th width="55">市场价</th>
                <th width="30">库存</th>
                <th width="45">备货期</th>
                <th width="50">状态</th>
                <!-- <th width="70">责任编辑</th> -->
                <th width="65">更新时间</th>
                <th width="15"></th>
            </tr>
            <?php $_from = $this->_tpl_vars['de']['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list']):
?>
            <tr >
                <td><input type="checkbox" value="<?php echo $this->_tpl_vars['list']['pid']; ?>
" class="checkitem" name="chk[]"></td>
                <td><?php echo $this->_tpl_vars['list']['pid']; ?>
</td>
                <td class="al" width="80" valign="middle" style="position:relative;">
                	<?php if ($this->_tpl_vars['list']['stock_shop']): ?>
                		<i style="background:url(/image/admin/<?php echo $this->_tpl_vars['list']['stock_shop']; ?>
.png);display: block;height: 32px;right: 1px;top:14px;position: absolute;width: 32px;"></i>
                	<?php endif; ?>
                	<a target="_blank" href="http://wx.52ywy.com/item-<?php echo $this->_tpl_vars['list']['pid']; ?>
.html">
                		<img class="img" alt="<?php echo $this->_tpl_vars['list']['pname']; ?>
" src="<?php echo $this->_tpl_vars['list']['pic']; ?>
" width="80" />
                	</a>
                </td>
                <td class="al" width="200">
                <h4><a target="_blank" href="http://wx.52ywy.com/item-<?php echo $this->_tpl_vars['list']['pid']; ?>
.html"><?php echo $this->_tpl_vars['list']['pname']; ?>
</a></h4>
                <p>编号：<?php echo $this->_tpl_vars['list']['code']; ?>
 &nbsp; SKU：<?php echo $this->_tpl_vars['list']['setmeal_nums']; ?>
<?php if ($this->_tpl_vars['list']['setmeal_nums'] > 1): ?> <a href="javascript:;" sku-op="<?php echo $this->_tpl_vars['list']['pid']; ?>
">sku上下架</a> <?php endif; ?></p>
                <p>分类：<?php echo $this->_tpl_vars['list']['catname']; ?>
</p>
                <p>所属品牌：<?php echo $this->_tpl_vars['list']['brand']; ?>
</p>
                </td>
                
                <td>
                <?php $_from = $this->_tpl_vars['list']['tags_arr']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list_tag']):
?>
                <p><?php echo $this->_tpl_vars['list_tag']; ?>
</p>
                <?php endforeach; endif; unset($_from); ?>
                </td>
                
                <td>
                <?php if ($this->_tpl_vars['list']['actInfo']): ?><a href="javascript:void(0);" title="<?php echo $this->_tpl_vars['list']['actInfo']['title']; ?>
" style="color:<?php if ($this->_tpl_vars['list']['actInfo']['status'] == 2): ?>gray<?php elseif ($this->_tpl_vars['list']['actInfo']['status'] == 3): ?>red<?php else: ?>green<?php endif; ?>;"><?php echo $this->_tpl_vars['list']['actInfo']['activity_id']; ?>
</a><?php else: ?>暂无<?php endif; ?>
                </td>
                
                <td style="position:relative;">
                <div class="showsku"  style="height:<?php if ($this->_tpl_vars['list']['setmeal_nums'] > 5): ?>90<?php else: ?><?php echo $this->_tpl_vars['list']['setmeal_nums']*18; ?>
<?php endif; ?>px; overflow:hidden;">
                <?php $_from = $this->_tpl_vars['list']['setmeal_spec']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list_spec']):
?>
                <p><?php echo $this->_tpl_vars['list_spec']; ?>
</p>
                <?php endforeach; endif; unset($_from); ?>
                </div>
                </td>
                
                <td style="position:relative;">
                <div class="showsku" style="height:<?php if ($this->_tpl_vars['list']['setmeal_nums'] > 5): ?>90<?php else: ?><?php echo $this->_tpl_vars['list']['setmeal_nums']*18; ?>
<?php endif; ?>px; overflow:hidden;">
                <?php $_from = $this->_tpl_vars['list']['setmeal_price']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list_price']):
?>
                <p><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list_price']; ?>
</p>
                <?php endforeach; endif; unset($_from); ?>
                </div>
                <?php if ($this->_tpl_vars['list']['setmeal_nums'] > 5): ?><em class="skumore" skunums="<?php echo $this->_tpl_vars['list']['setmeal_nums']; ?>
">↓↓↓</em><?php endif; ?>
                </td>
                
                <td style="position:relative;">
                <div class="showsku" style="height:<?php if ($this->_tpl_vars['list']['setmeal_nums'] > 5): ?>90<?php else: ?><?php echo $this->_tpl_vars['list']['setmeal_nums']*18; ?>
<?php endif; ?>px; overflow:hidden;">
                <?php $_from = $this->_tpl_vars['list']['setmeal_market_price']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list_market_price']):
?>
                <p><?php echo $this->_tpl_vars['config']['money']; ?>
<?php echo $this->_tpl_vars['list_market_price']; ?>
</p>
                <?php endforeach; endif; unset($_from); ?>
                </div>
                </td>
                <td style="position:relative;">
                <div class="showsku" style="height:<?php if ($this->_tpl_vars['list']['setmeal_nums'] > 5): ?>90<?php else: ?><?php echo $this->_tpl_vars['list']['setmeal_nums']*18; ?>
<?php endif; ?>px; overflow:hidden;">
                <?php $_from = $this->_tpl_vars['list']['setmeal_stock']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['list_stock']):
?>
                <p><?php echo $this->_tpl_vars['list_stock']; ?>
</p>
                <?php endforeach; endif; unset($_from); ?>
                </div>
                </td>
                
                <td><?php echo $this->_tpl_vars['list']['waiting_time_desc']; ?>
</td>
                
                <td><?php if ('0' === $this->_tpl_vars['list']['status']): ?>未送审<?php endif; ?>
                <?php if ("-2" === $this->_tpl_vars['list']['status']): ?><span style="color:orange">已送审</span><?php endif; ?>
                <?php if ('1' === $this->_tpl_vars['list']['status']): ?><span style="color:green">已上架</span><?php endif; ?>
                <?php if ('2' === $this->_tpl_vars['list']['status']): ?><span style="color:blue">推荐</span><?php endif; ?>
                <?php if ("-1" === $this->_tpl_vars['list']['status']): ?><span style="color:red">被驳回</span><?php endif; ?>
                <?php if ("-3" === $this->_tpl_vars['list']['status']): ?><span style="color:#ccc">已下架</span><?php endif; ?>
                </td>
                <!-- <td><?php echo $this->_tpl_vars['list']['create_user']; ?>
</td> -->
                <td><?php echo ((is_array($_tmp=$this->_tpl_vars['list']['uptime'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%Y-%m-%d %H:%M:%S") : smarty_modifier_date_format($_tmp, "%Y-%m-%d %H:%M:%S")); ?>
</td>
                
                <td>
                <a href="?m=product&s=product_launch.php&edit=<?php echo $this->_tpl_vars['list']['pid']; ?>
<?php echo $this->_tpl_vars['url']; ?>
"><?php echo $this->_tpl_vars['editimg']; ?>
</a>
                </td>
            </tr>
            <?php endforeach; else: ?>
            <tr>
                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
            </tr>
            <?php endif; unset($_from); ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="99"><div class="page"><?php echo $this->_tpl_vars['de']['page']; ?>
</div>共有<?php echo $this->_tpl_vars['countpro']; ?>
个产品</td>
            </tr>
        </tfoot>
    </table>
    </form>
</div>
<script>

$('.skumore').click(function(){
	
	var skunums=parseInt($(this).attr('skunums'));
	
	var $showdivs=$(this).parent().parent().find('.showsku');
	
	if(skunums<=5){
		return ;
	}else{
		if($(this).html()=='↓↓↓'){
		
		//$showdivs.addClass('overlayout');
		$(this).html('↑↑↑');
		$showdivs.each(function(){
			var h=18*skunums;
			$(this).height(h);
		});
		}else{
			$showdivs.height(90);
			$(this).html('↓↓↓');
		}
	}
	
	
});



//默认待选品牌
$('#brand').bind('click',function(e){
		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product.php&operation=getbrand&brandname=',function(data){
			$('#brandlist').show();
			$('#brandlist').html(""+data);
		});
});
//直接搜品牌
$('#brand').bind('input',function(e){
	var value=$(this).val();
	if(value==''){
		$('#brandlist').hide();
		return ;
	}
	else{
		$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product.php&operation=getbrand&brandname='+value,function(data){
			$('#brandlist').show();
			$('#brandlist').html(""+data);
		});
	}
});
$('body').bind('click',function(e){
	$('#brandlist').hide();
});
$('#brandlist').delegate('li','click',function(){
	var _this=$(this);
	var brandName=_this.text();
		var brandId=_this.attr('bid');
		$('#brand').val(brandName);
		$('#brandid').val(brandId);
		$('#brandlist').hide();
});


$.each($('[stock]'),function(){//库存
	//alert($(this).attr('stock'));
	var $stock=$(this);
	
	$.get('<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=inventory_api.php&stock='+$(this).attr('stock'),function(data){
		$stock.html(data);
	});

	
})

$(".op_button").click(function () {
	var obj=$("input[class='checkitem']:checked");
	if(confirm('确认此操作？')){
		if(!obj.length)
		{
			alert("请选择数据，再进行操作!");
			return false;
		}
		//alert($(this).attr('type'));
		$("input[name='type']").val($(this).attr('type'));
	$("#form")[0].submit();
	return false;
	}
});
$("#unify_price").click(function () {
	
	alert('此功能暂缓开通');
	return false;
	
	var obj=$("input[class='checkitem']:checked");
	if(!obj.length)
	{
		alert("请选择数据，再进行操作!");
		return false;
	}
	var str='';
	$.each(obj,function(i){
		str+=$(this).val()+',';
	});
	
	window.parent.iframe_form("unify", '调整价格', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_unify.php&type=price&id='+str, 800,400);
	return false;
});

$("#unify_limit").click(function () {
	
	var obj=$("input[class='checkitem']:checked");
	if(!obj.length)
	{
		alert("请选择数据，再进行操作!");
		return false;
	}
	var str='';
	$.each(obj,function(i){
		str+=$(this).val()+',';
	});
	
	window.parent.iframe_form("unify", '调整限购', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_unify.php&type=limit&id='+str, 800,400);
	return false;
});


$("#change_cat").click(function () {
	alert('此功能暂缓开通');
	return false;
	var obj=$("input[class='checkitem']:checked");
	if(!obj.length)
	{
		alert("请选择数据，再进行操作!");
		return false;
	}
	var str='';
	$.each(obj,function(i){
		str+=$(this).val()+',';
	});
	window.parent.iframe_form("change_cat", '移动分类', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_unify.php&type=cat&id='+str, 800,300);

	
});

$("#unify_stock").click(function () {
		
	var obj=$("input[class='checkitem']:checked");
	if(!obj.length)
	{
		alert("请选择数据，再进行操作!");
		return false;
	}
	var str='';
	$.each(obj,function(i){
		str+=$(this).val()+',';
	});
	
	window.parent.ajax_form("unify", '调整库存', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_unify.php&type=stock&id='+str, 800);
	return false;
});

$("a[sku-op]").click(function(){
 	alert("此功能暂缓开通!");
		return false;
	var pid =$(this).attr('sku-op');
	window.parent.iframe_form("sku-operation", 'sku上下架', '<?php echo $this->_tpl_vars['config']['weburl']; ?>
/admin/module.php?m=product&s=product_unify.php&type=skuop&id='+pid, 800,300);

	//alert(pid);
})

</script>    
</body>
</html>